package leetcode.string;

public class Lc2414 {


    public int longestContinuousSubstring(String s) {

        int ans = 1;
        int cnt = 0;
        for (int i = 0; i < s.length(); i++) {
            if (i == 0 || s.charAt(i) != s.charAt(i - 1) + 1) {
                cnt = 1;
            } else if (s.charAt(i) == s.charAt(i - 1) + 1) {
                cnt++;
                ans = Math.max(ans, cnt);
                if (ans == 26) return ans;
            }
        }
        return ans;
    }


}
